package com.tarena.lbs.business.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tarena.lbs.base.protocol.pager.PageResult;
import com.tarena.lbs.business.pojo.po.BusinessPO;
import com.tarena.lbs.business.pojo.query.BusinessQuery;
import com.tarena.lbs.business.pojo.vo.BusinessStoreVO;
import com.tarena.lbs.business.pojo.vo.BusinessVO;
import com.tarena.lbs.business.pojo.vo.StatisticsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface BusinessMapper  extends BaseMapper<BusinessPO> {
    List<BusinessVO> selectPageList(BusinessQuery query);

//    BusinessStoreVO businessStoreDetail(Integer businessId);
    @Select("SELECT id, business_name as businessName, industry_type as industryType, business_head_name as businessHeadName, business_head_phone as businessHeadPhone, company_address as companyAddress, business_license as businessLicense, business_introduction as businessIntroduction, entry_time as entryTime, business_status as businessStatus, audit_remarks as auditRemarks " +
            "FROM lbs_business " +
            "WHERE id = #{businessId} " +
            "AND business_status = 2")
    BusinessStoreVO selectBusinessDetail(@Param("businessId") Integer businessId);

@Select("SELECT id,business_name as businessName " +
        "FROM lbs_business ")
    List<StatisticsVO> selectAllBusiness();

@Select("SELECT COUNT(*) " +
        "FROM lbs_store " +
        "WHERE business_id = #{id}")
    int countStoreById(Integer id);

@Select("SELECT user_id,user_name " +
        "FROM lbs_article " +
        "WHERE ")
    BusinessStoreVO getBusinessDetail(Integer articleId);
}
